package com.rd.student.ruanjian.class4.zhouzihe.day0731;

import java.util.Arrays;
import java.util.HashSet;

public class TestRandom3 {
    public static void main(String[] args) {
        int[] arr = new int[50];
        for (int i = 0; i < 50; i++) {
            arr[i] = i;
        }
        System.out.println(Arrays.toString(arr));
        HashSet<Integer> set = new HashSet();
        while (set.size() < 20) {
            int random = (int) (Math.random() * 50);
            System.out.println("随机的结果:" + arr[random]);
            set.add(arr[random]);
        }
    }
}
